[Alerting v2] Fix rule preview error in alerting_v2 due to missing EUI theme context#261476
Merged
Merged
Conversation
Contributor
ApprovabilityVerdict: Would Approve This is a straightforward bug fix that adds missing EUI theme context by wrapping React components with Macroscope would have approved this PR. A repo admin can enable approvability here. |
yiannisnikolopoulos
approved these changes
Apr 7, 2026
kelvtanv
pushed a commit
to kelvtanv/kibana
that referenced
this pull request
Apr 7, 2026
…I theme context (elastic#261476) Resolves elastic#260954 ### Summary - Fixes `Cannot read properties of undefined (reading 'font')` error when rendering the Lens chart in the alerting_v2 rule preview - Wraps both app mount functions with `coreStart.rendering.addContext()` to provide the EUI theme (and other Kibana global context) to the React tree ### Root Cause The alerting_v2 app mounts via ReactDOM.render() which creates a standalone React tree without any EUI ThemeProvider. When Lens renders its embeddable chart inside the rule preview, `lnsNumericFontStyles` reads `euiTheme.font.family` (PR: elastic#251576) from Emotion's theme context which is undefined without the provider, causing the error. ### Testing - Open alerting_v2 rule form and trigger a rule preview with an ES|QL query that renders a Lens chart - Verify the chart renders without errors - Verify notification policies page still loads correctly ### Screenshots <img width="1234" height="781" alt="Screenshot 2026-04-07 at 10 21 24 AM" src="https://github.com/user-attachments/assets/9375415e-8aae-493a-b8c3-006db48333ca" />
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #260954
Summary
Cannot read properties of undefined (reading 'font')error when rendering the Lens chart in the alerting_v2 rule previewcoreStart.rendering.addContext()to provide the EUI theme (and other Kibana global context) to the React treeRoot Cause
The alerting_v2 app mounts via ReactDOM.render() which creates a standalone React tree without any EUI ThemeProvider. When Lens renders its embeddable chart inside the rule preview,
lnsNumericFontStylesreadseuiTheme.font.family(PR: #251576) from Emotion's theme context which is undefined without the provider, causing the error.Testing
Screenshots